from django.http import HttpResponse, HttpResponseNotFound, JsonResponse
from django.shortcuts import render, redirect


# Create your views here.
def index(request):
    return redirect("/blog/2")
    # content_value = {"msg": "学Python，上www.python222.com"}
    # return render(request, 'index.html', context=content_value)

    # return JsonResponse({'foo': 'bar'})
    # return HttpResponseNotFound()
    # html = "<font color='red'>学Python，上www.python222.com</font>"
    # return HttpResponse(html, status=200)


def blog(request, id):
    if id == 0:
        return redirect("/s2/error.html")
    else:
        return HttpResponse("id是" + str(id) + "的博客页面")


def blog2(request, year, month, day, id):
    return HttpResponse(str(year) + '/' + str(month) + '/' + str(day) + '/' + '  id是' + str(id) + "的博客页面")


def blog3(request, year, month, day):
    return HttpResponse(str(year) + '/' + str(month) + '/' + str(day) + "的博客页面")
